home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4347 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.umbc.edu!not-for-mail
  2. From: schlein@umbc.edu (Jonas J. Schlein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP - why isn't ld working
  5. Date: 3 Feb 1996 16:36:11 -0500
  6. Organization: University of Maryland Baltimore County
  7. Message-ID: <4f0kgb$6gj@umbc9.umbc.edu>
  8. References: <4etai7$22s@deadbird.db.erau.edu>
  9. NNTP-Posting-Host: umbc9.umbc.edu
  10. NNTP-Posting-User: schlein
  11.  
  12. Darryl E. Marsee <marseed@news.db.erau.edu> wrote:
  13. |> Greetings.  Got a user with the following problem:
  14. |> He has two source files, called ex5.c:
  15.  
  16. <snip>
  17.  
  18. |> and ex5a.c:
  19.  
  20. <snip>
  21.  
  22. |> if he does the following:
  23. |> 
  24. |>  gcc ex5.c ex5a.c
  25. |> 
  26. |> It produces a correctly executing a.out.  So far so good.
  27. |> 
  28. |> Again under all three operating systems, if he does the following instead:
  29. |> 
  30. |>  gcc -c ex5.c
  31. |>  gcc -c ex5a.c
  32. |> 
  33. |> Everything compiles fine.  However, if he then tries to link them to 
  34. |> produce an executable with the following:
  35. |> 
  36. |>  ld ex5.o ex5a.o -lc
  37.  
  38. Tell him don't do that ;-). Either stick with the first way or instead of
  39. using ld use gcc with the command line:
  40.  
  41. gcc ex5.o ex5a.o
  42.  
  43. You can add the -lc, but it's probably not necessary.
  44. -- 
  45. "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
  46.  
  47. Jonas J. Schlein  (schlein@gl.umbc.edu)
  48.